// import axios from 'axios'
import qs from 'qs'
import request from './request'

// 获取用户信息 /shop/userProfiles
export const UserInfoApi = () => request.get('/shop/userProfiles')

// 微信扫码登录 /wechatUsers/PCLogin
export const WeiXinLoginApi = (params) => request.post(`/wechatUsers/PCLogin`, qs.stringify(params))

// 手机号验证码登录(含注册) /phoneRegin
export const LoginApi = (params) => request.post('/phoneRegin', qs.stringify(params))

// 发送注册短信验证码 /sendSMS
export const getCodeApi = (params) => request.post('/sendSMS', qs.stringify(params))

// 手机绑定微信 /wechatUsers/binding
export const BindWechatApi = (params) => request.post('/wechatUsers/binding', qs.stringify(params))

// 精品推荐接口
export const JingpinApi = () => request.get('/products/recommend')

// 热门兑换 /products/hot
export const HotApi = () => request.get("/products/hot")

// 商品详情接口
export const GoodsDetailsApi = (params) => request.get(`/products/${params}`)

// 商品页数据请求
export const GoodsDataApi = (params) => request.get('/products', {
    params
})

// 手机解绑微信 （登录状态下）
export const UnBindWechatApi = () => request.put('/wechatUsers/unbindingWeChat')

// 查看购物车 /shop/carts
export const CartDataApi = () => request.get('/shop/carts')

// 购物车删除商品
export const CartDelApi = (params) => request.delete(`/shop/carts?productIds=${params.id}`)

// 加入到购物车 /shop/carts/add
export const AddToCartApi = (params) => request.post('/shop/carts/add', qs.stringify(params))